package com.th.supcom.pds.internal.client.widget;

import java.util.List;

import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.th.supcom.pds.common.client.model.CodeConstants;
import com.th.supcom.pds.common.client.model.PdsSupplyDetailModel;
import com.th.supcom.pds.dispensedrug.client.service.DispenseDrugRpc;
import com.th.supcom.pds.dispensedrug.client.service.DispenseDrugRpcAsync;

public class PhamBatchCombox extends ComboBox <PdsSupplyDetailModel>
{

    private static final DispenseDrugRpcAsync s_DISPENSEDRUGRPCASYNC = GWT.create (DispenseDrugRpc.class);

    /**
     * 构造函数
     * 
     * @param width
     */
    public PhamBatchCombox (final int width)
    {
        store = new ListStore <PdsSupplyDetailModel> ();
        super.setDisplayField ("phamBatchNumber");
        super.setTriggerAction (TriggerAction.ALL);
        super.setWidth (width);
    }

    /**
     * 加载数据
     * 
     * @param model
     */
    public void loadData (final PdsSupplyDetailModel model)
    {
        /*PhamBatchCombox.s_DISPENSEDRUGRPCASYNC.getPhamBatchByExample (model, new AsyncCallback <List <PdsSupplyDetailModel>> ()
        {

            @Override
            public void onFailure (final Throwable caught)
            {
                MessageBox.alert (CodeConstants.PROMPT, "批次号加载失败", null);
            }

            @Override
            public void onSuccess (final List <PdsSupplyDetailModel> result)
            {
                store.removeAll ();
                store.add (result);

            }
        });*/
    }

}
